import BaseView from '../base/View';
import './index.less';
import { viewTypes } from "../../../../../constants/form";

const { READONLY } = viewTypes;

export default class ColumnPanel2View extends BaseView {
  renderContent() {
    const { data: { size, coms }, renderItem } = this.props;
    const style = { width: `${1 / size * 100}%` };

    return (
      <div className='wea-edc-columnpanel-row'>
        {Array(size).fill(0).map((s, index) => (
          <div style={style}>
            {renderItem(coms[index])}
          </div>
        ))}
      </div>
    );
  }
  
  renderForReadonly() {
    const { data: { size, coms }, renderItem } = this.props;
    const style = { width: `${1 / size * 100}%` };

    return (
      <div className='wea-edc-columnpanel-row'>
        {Array(size).fill(0).map((s, index) => (
          <div style={style}>
            {renderItem(coms[index], { viewType: READONLY })}
          </div>
        ))}
      </div>
    );
  }
}